﻿#请求CAMKE的最小构建版本
cmake_minimum_required(VERSION 3.5)
#设置项目名称
project(StashManage VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(CMake_Config.cmake)
#上一级目录
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
#查找include目录下的所有*.hpp,*.h头文件,并路径列表保存到 INCLUDE_DIR_LIST 变量中
FIND_INCLUDE_DIR(INCLUDE_MySrc "Src" )	
FIND_INCLUDE_DIR(INCLUDE_MyTest  "Test")	
include_directories(${INCLUDE_MySrc})
include_directories(${INCLUDE_MyTest})

#递归搜索目录下的源文件添加到变量中 "${PARENT_DIR}/MyQt/Src/*.cpp"
file(GLOB_RECURSE cppFile   "Src/*.cpp" )
file(GLOB_RECURSE ResFile "Resource/*.qrc")

find_package(QT NAMES Qt6  REQUIRED COMPONENTS Widgets Core5Compat Network Gui Sql Charts Core)
find_package(Qt6 REQUIRED COMPONENTS Widgets Core5Compat Network Gui Sql Charts Core)

find_package(XQt6  REQUIRED)
message(STATUS "XQt6_FOUND = ${XQt6_FOUND}")

#设置图标
#aux_source_directory(. MY_SCOURCES)
#设置可执行文件的输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
#添加参加编译的文件
add_executable(${PROJECT_NAME}
${cppFile}
${ResFile}
${XQt6_Res}
"Resource/icon.rc")
target_link_libraries(${PROJECT_NAME} 
XQt6)